##analysis_master.r
###master document for replications of:
####Enos, Ryan D. and Noam Gidron, 
  ###"Intergroup Behavioral Strategies as Contextually Determined: Experimental Evidence from Israel"
  ###Journal of Politics
####RdE 11/2015

rm(list = ls())
library(sandwich)
library(lmtest)
library(RColorBrewer)
library(apsrtable)
library(Zelig)
library(xtable)
library(stargazer)
library(Matrix)

cat('Starting analysis...\n \n \n \n')

##load data
load('indata/EnosGidronData.RData')  

##calls functions needed for other scirpts
source('scripts/function_call.r')

##graph of population projects
source('scripts/population_projections.r')

##tables of basic distributions of responses
source('scripts/basic_distributions.r')  

##regressions based on contextual variation
##calls for separate files with dependent variables and saves them in master list, produces figure for output
source('scripts/geo_regressions_master.r')  

##results by locality
source('scripts/geo_variation_test.r')###analyze each city by a t test for differenc

##run selection checks on contextual analysis, including creating an output plot
source('scripts/selection_check.r') 
	
##contextual analysis while iteratively dropping each location
source('scripts/geo_regressions_master_iterative.r')

##observational data analysis in Appendix
source('scripts/obs_data_2009.r')

##descriptive tables in Appendix
source('scripts/descriptive_table.r')


cat('\n \n ... Done. Output in "EnosGidronReplication/output".')
